package com.magenta.maxoptra.gis;

import com.magenta.maxoptra.gis.commons.Pair;

import java.util.List;

/*
* Project: MaxOptRA v1.2
* User: Ivan Usalko
* Date: 16.09.2009 12:44:14
*
* Copyright (c) 1999-2009 Magenta Corporation Ltd. All Rights Reserved.
* Magenta Technology proprietary and confidential.
* Use is subject to license terms.
*/
/**
 * Interface ProvidersRegistry.<br>
 * Class contains three methods:<br>
 * <li>Getting registered provider type {@link #getProviderKey}.</li>
 * <li>List of all connections registered on provider {@link #getConnections}.</li>
 * <li>Register new connection {@link #register}.</li>
 */
public interface ProvidersRegistry {

    public static final String JNDI_NAME = "ProvidersRegistry";

    /**
	 * Return class name implemented geo informational interfaces for provider.
	 * @param providerName
	 * @param versionApi
	 * @return
	 */
	String getImplementor(String providerName, String versionApi);

    /**
     * Return provider name and version api for connection id.
     * @param connectionId connection id.
     * @return null if connection not registered.
     */
    Pair<String, String> getProviderKey(Long connectionId);

    /**
     * List all connections registered for provider.
     * @param providerName provider type.
     * @param versionApi version API for access to external provider.
     * @return list of connection id.
     */
    List<Long> getConnections(String providerName, String versionApi);

    /**
     * Register new connection to provider.
     * @param connectionId http client id.
     * @param providerName provider type.
     * @param versionApi version API for access to external provider.
     */
    void register(Long connectionId, String providerName, String versionApi);

    /**
     * Assign CID to geo provider
     *
     * @param cid new cid
     * @param discriminator additional identifier of CID
     */
    void assignCID(Long cid, String providerName, String versionApi, String discriminator);
}